package top.jasonlam.car.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Null;
import java.util.Date;

/**
 * Reply
 *
 * @blame Android Team
 */
@Entity
@Table(name = "reply")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Reply {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    Long id;

    @Column(name = "content", nullable = false)
    @NotEmpty(message = "不能发布空评论")
    private String content;

    @Column(name = "replydate", nullable = false)
    @Null(message = "发布日期由系统生成")
    @CreationTimestamp
    private Date replyDate;

    @Column(name = "commentname", nullable = false, length = 20)
    @NotEmpty(message = "被评论人账号不能为空")
    private String commentName;

    @Column(name = "replyname", nullable = false, length = 20)
    @NotEmpty(message = "评论人账号不能为空")
    private String replyName;

    @Column(name = "commentid", nullable = false)
//    @NotEmpty(message = "所属评论不能为空")
    private Long commentId;
}
